/***********************************************************************
 * POJO Class :  DocD.java
 * Author:  Bill Vison
 * Purpose: Defines the Class SysResource
 ***********************************************************************/

package edu.gtcfla.km.model;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;

import org.hibernate.annotations.GenericGenerator;

import edu.gtcfla.km.Category;
import edu.gtcfla.km.Doc;

@javax.persistence.Entity
@javax.persistence.Table(name = "DOCUMENT")
@Inheritance(strategy=InheritanceType.JOINED)
public class DocD implements Doc, java.io.Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1L;

	@Column(name ="DOC_ID")
	@GeneratedValue(generator = "paymentableGenerator")      
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid") 	
	@Id	
	private String id;	
	
	@Override
	public String getId() {
		// TODO Auto-generated method stub
		return id;
	}

	@Override
	public void setId(String id) {
		// TODO Auto-generated method stub
		this.id = id ;
	}

	@Column(name ="SUBJECT")	
	private String title;
	
	@Override
	public String getTitle() {
		// TODO Auto-generated method stub
		return title;
	}

	@Override
	public void setTitle(String title) {
		// TODO Auto-generated method stub
		this.title = title;
	}
	
	@Column(name ="SHARED")		
	private short shared;
	
	public short getShared() {
		return shared;
	}

	public void setShared(short shared) {
		this.shared = shared;
	}

	@Column(name ="RELEASE_USER_ID")		
	private String releasedUserId;
	
	@Override
	public String getReleasedUserId() {
		// TODO Auto-generated method stub
		return releasedUserId;
	}

	@Override
	public void setReleasedUserId(String userId) {
		// TODO Auto-generated method stub
		this.releasedUserId = userId;
	}
	
	@Column(name ="RELEASE_DATE")		
	private Date releasedDate;	

	@Override
	public Date getReleasedDate() {
		// TODO Auto-generated method stub
		return releasedDate;
	}

	@Override
	public void setReleasedDate(Date inputDate) {
		// TODO Auto-generated method stub
		this.releasedDate = inputDate;
	}
	
	@javax.persistence.ManyToOne(
			cascade = { javax.persistence.CascadeType.MERGE}
			,fetch = javax.persistence.FetchType.LAZY )
	@JoinTable(
			name="KM_CATEGORY_MAP",
			joinColumns = @JoinColumn( name="DOC_ID"),
			inverseJoinColumns = @JoinColumn( name="CATEGORY_ID")
		)	
	private CategoryD categoryD;

	public CategoryD getCategoryD() {
		return categoryD;
	}

	public void setCategoryD(CategoryD categoryD) {
		this.categoryD = categoryD;
	}

	@Override
	public Category getCategory() {
		// TODO Auto-generated method stub
		Category cate = this.getCategoryD();
		return cate;
	}

	@Override
	public void setCategory(Category category) {
		// TODO Auto-generated method stub
		this.setCategoryD( (CategoryD)category );
	}

	@Column(name ="USER_GROUP_ID")		
	private String userGroupId;	
	
	@Override
	public String getUserGroupId() {
		// TODO Auto-generated method stub
		return userGroupId;
	}

	@Override
	public void setUserGroupId(String userGroupId) {
		// TODO Auto-generated method stub
		this.userGroupId = userGroupId;
	}




	
	
	
}